
use "\replication_dataset.dta"

*** ANALYSIS ***

* Figure 1 // Bills
graph hbox bills if COW != 475, over(COWcode, sort(1)) nooutside
sum bills if COW == 475

* Figure 2 // Issue attention
graph hbox topic15 if COW != 475, over(COWcode, sort(1)) nooutside
sum topic15 if COW == 475
graph hbox topic12 if COW != 475, over(COWcode, sort(1)) nooutside
sum topic12 if COW == 475
graph hbox topic3 if COW != 475, over(COWcode, sort(1)) nooutside
sum topic3 if COW == 475
graph hbox topic20 if COW != 475, over(COWcode, sort(1)) nooutside

* Figure 3 // Diversity, Stability
graph hbox shannons_h if COW != 475, over(COWcode, sort(1)) nooutside
graph hbox volatility if COW != 475, over(COWcode, sort(1)) nooutside

* Figure 4 // Democracy index
graph hbox v2x_polyarchy, over(COWcode, sort(1)) nooutside

*Figure 5
graph hbox v2xlg_legcon if COW != 475, over(COWcode, sort(1)) nooutside
graph hbox v2psoppaut if COW != 475, over(COWcode, sort(1)) nooutside
graph hbox v2lgotovst if COW != 475, over(COWcode, sort(1)) nooutside
graph hbox v2lgfunds if COW != 475, over(COWcode, sort(1)) nooutside
graph hbox v2lgcomslo if COW != 475, over(COWcode, sort(1)) nooutside
graph hbox v2lgstafflo if COW != 475, over(COWcode, sort(1)) nooutside

* Table 2
sum bills shannons_h volatility
sum wdi_pop wdi_gdpgr wdi_lifexp v2x_jucon v2xlg_legcon v2psoppaut v2lgotovst leg_intro_bills if bills != . & polyarchy_mean != .
sum v2lgfunds v2lgcomslo v2lgstafflo wgov_min
sum prob_legis v2elloseat i.v2eltype_sum v2lgbicam election_year i.v2elparlel
sum seats

* Table 4
xtreg bills      c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg shannons_h c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg volatility c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)

*** APPENDIX ***
* Table A1
xtreg bills      c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp i.year if laws == 0, re cluster (country)
xtreg shannons_h c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp i.year if laws == 0, re cluster (country)
xtreg volatility c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp i.year if laws == 0, re cluster (country)

* Table A2
xtreg bills      c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp i.year if laws == 1, re cluster (country)
xtreg shannons_h c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp i.year if laws == 1, re cluster (country)
xtreg volatility c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp i.year if laws == 1, re cluster (country)

* Table A3
xtreg bills      c.v2x_polyarchy laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg shannons_h c.v2x_polyarchy laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg volatility c.v2x_polyarchy laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)

* Table A4
xtreg bills      l.v2x_polyarchy laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg shannons_h l.v2x_polyarchy laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg volatility l.v2x_polyarchy laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)

* Table A5
xtreg bills      c.v2x_polyarchy laws lpop wdi_gdpgr wdi_lifexp i.year, fe cluster (country)
xtreg shannons_h c.v2x_polyarchy laws lpop wdi_gdpgr wdi_lifexp i.year, fe cluster (country)
xtreg volatility c.v2x_polyarchy laws lpop wdi_gdpgr wdi_lifexp i.year, fe cluster (country)

* Table A6
xtset COWcode year
xtreg bills      l.bills      c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg shannons_h l.shannons_h c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg volatility l.volatility c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)

* Table A7
xtreg no_topic   c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg kurtosis_y c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country) 

* Table A8
xtreg bills      c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp v2x_jucon v2xlg_legcon v2psoppaut v2lgotovst leg_intro_bills i.year, re cluster (country)
xtreg bills      c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp v2lgfunds v2lgcomslo v2lgstafflo wgov_min i.year, re cluster (country)
xtreg bills      c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp prob_legis v2elloseat i.v2eltype_sum v2lgbicam election_year i.v2elparlel i.year, re cluster (country)

xtreg shannons_h      c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp v2x_jucon v2xlg_legcon v2psoppaut v2lgotovst leg_intro_bills i.year, re cluster (country)
xtreg shannons_h      c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp v2lgfunds v2lgcomslo v2lgstafflo wgov_min i.year, re cluster (country)
xtreg shannons_h      c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp prob_legis v2elloseat i.v2eltype_sum v2lgbicam election_year i.v2elparlel i.year, re cluster (country)

xtreg volatility      c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp v2x_jucon v2xlg_legcon v2psoppaut v2lgotovst leg_intro_bills i.year, re cluster (country)
xtreg volatility      c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp v2lgfunds v2lgcomslo v2lgstafflo wgov_min i.year, re cluster (country)
xtreg volatility      c.polyarchy_mean c.polyarchy_dev laws lpop wdi_gdpgr wdi_lifexp prob_legis v2elloseat i.v2eltype_sum v2lgbicam election_year i.v2elparlel i.year, re cluster (country)

* Table A9
xtreg bills      c.libdem_mean c.libdem_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg shannons_h c.libdem_mean c.libdem_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg volatility c.libdem_mean c.libdem_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)

* Table A10
xtreg bills      c.free_elec_mean c.free_elec_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg shannons_h c.free_elec_mean c.free_elec_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg volatility c.free_elec_mean c.free_elec_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)

* Table A11
xtreg bills      c.free_expr_mean c.free_expr_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg shannons_h c.free_expr_mean c.free_expr_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg volatility c.free_expr_mean c.free_expr_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)

* Table A12
xtreg bills      c.free_assoc_mean c.free_assoc_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg shannons_h c.free_assoc_mean c.free_assoc_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
xtreg volatility c.free_assoc_mean c.free_assoc_dev laws lpop wdi_gdpgr wdi_lifexp i.year, re cluster (country)
